package com.jinwei.qunguanjia.common.utils;

/**
 * 生成随机码工具类
 * 
 */
public class RandomUtils {

	// 生成指定位数的随机码
	public static String getRandomCode(int length) {
		StringBuffer randomCode = new StringBuffer();
		for (int i = 0; i < length; i++) {
			randomCode.append((int) (Math.random() * 10));
		}
		return randomCode.toString();
	}

	public static void main(String[] args) {
		System.out.println(RandomUtils.getRandomCode(4));
	}
}
